package com.whfc.base.redis.impl;

import com.whfc.base.redis.SyncConfigRedisDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Repository;

import java.util.concurrent.TimeUnit;

@Repository
public class SyncConfigRedisDaoImpl implements SyncConfigRedisDao {

    @Autowired
    private StringRedisTemplate redisTemplate;

    @Override
    public void setSZJToken(String key, String token,Integer hour) {
        redisTemplate.opsForValue().set(key, token, hour, TimeUnit.HOURS);
    }

    @Override
    public String getSZJToken(String key) {
        return redisTemplate.opsForValue().get(key);
    }

    @Override
    public String getValue(String key) {
        return redisTemplate.opsForValue().get(key);
    }

    @Override
    public void setValue(String key, String token, Integer hour) {
        redisTemplate.opsForValue().set(key, token, hour, TimeUnit.HOURS);
    }
}
